package test.fastjson;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.luotao.devp.base.test.TesterConcurrent;
import com.luotao.devp.base.utils.StringUtils;
import test.JsonTest;

import java.util.Random;

/**
 * Created by IntelliJ IDEA.
 * User: luotao
 * Date: 12-5-29
 * Time: 15:13
 */
public class Obj_JsonStr_Str_Obj implements TesterConcurrent.ITestable {
    @Override
    public void execute(long index, long threadid, int loop_index) throws Exception {
        JsonTest.Request req = new JsonTest.Request();
        req.setFlowid(StringUtils.fillZero(index, 24));
        req.setCustomerId(StringUtils.fillZero(index, 20));
        req.setSendType((byte) loop_index);
        req.setTradeMoney((int) threadid);

        req.setCreatetime((int) System.currentTimeMillis());
        req.setConfirmTime((int) System.currentTimeMillis());
        req.setMappedFlowid(StringUtils.fillZero(String.valueOf(threadid), 24));
        req.setGameCode((int) loop_index);

        req.setChannelType((byte) (loop_index * 4));
        req.setMobileOSType("iphone" + index);
        req.setMultiple((short) new Random().nextInt(99));
        req.setPeroid("peroid" + index);

        req.setAutoAwardTime((int) System.currentTimeMillis());
        req.setEndAwardTime((int) System.currentTimeMillis());
        req.setAutoBingoMoney((int) index);
        req.setTicketConent(StringUtils.fillZero(String.valueOf(threadid), 128).getBytes());

        String str = JSON.toJSONString(req);

        JsonTest.Request ress = JSON.parseObject(str, JsonTest.Request.class);
        ress.getAutoAwardTime();

    }
}
